﻿@model Telerik.Web.Mvc.GridModel<ShippingMethodModel>
@using Telerik.Web.Mvc.UI;
@using System.Linq;
@{    
    //page title
    ViewBag.Title = @T("Admin.Configuration.Shipping.Methods").Text;
}
<div class="section-header">
    <div class="title">
        <img src="@Url.Content("~/Administration/Content/images/ico-configuration.png")" alt="" />
        @T("Admin.Configuration.Shipping.Methods")
    </div>
    <div class="options">
        <a href="@Url.Action("CreateMethod")" class="t-button">@T("Admin.Common.AddNew")</a>
    </div>
</div>
<table class="adminContent">
    <tr>
        <td>
            @(Html.Telerik().Grid(Model.Data)
                    .Name("shippingmethod-grid")
                    .DataKeys(x =>
                    {
                        x.Add(y => y.Id).RouteKey("Id");
                    })
                    .Columns(columns =>
                    {
                        columns.Bound(x => x.Name).Width(200);
                        columns.Bound(x => x.Description).Width(400);
                        columns.Bound(x => x.DisplayOrder).Width(100);
                        columns.Bound(x => x.Id)
                            .Template(x => Html.ActionLink(T("Admin.Common.Edit").Text, "EditMethod", new { id = x.Id }))
                            .ClientTemplate("<a href=\"EditMethod/<#= Id #>\">" + T("Admin.Common.Edit").Text + "</a>")
                            .Width(50)
                            .Centered()
                            .HeaderTemplate(T("Admin.Common.Edit").Text);
                    })
                    .DataBinding(dataBinding => dataBinding.Ajax().Select("Methods", "Shipping"))
                    .EnableCustomBinding(true))
        </td>
    </tr>
</table>
